<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
include_once "common.php";
class event_type
{
    function event_type()
    {
        global $baseinfo_c;
         $baseinfo_c =new baseinfo_common();
    }
    function insert($zh_hk,$en_us="",$zh_cn="",$color_mark="")
    {
		 global $baseinfo_c;
        if($zh_hk==null || $zh_hk=='')
        {
            return 0;//error
        }
        $strSql="INSERT INTO event_type(name_en_us,name_zh_hk,name_zh_cn,color_mark,delete_flag) VALUE ('".$baseinfo_c->utf8trim($en_us)."','".$baseinfo_c->utf8trim($zh_hk)."','".$baseinfo_c->utf8trim($zh_cn)."','".$baseinfo_c->utf8trim($color_mark)."',0);";
       
        $baseinfo_c->execSql($strSql);
    }
    function delete($keyValue)
    {
         global $baseinfo_c;
         $baseinfo_c->deleteRecord("event_type","etid",$baseinfo_c->utf8trim($keyValue));
    }
    function update($keyValue,$zh_hk,$en_us="",$zh_cn="",$color_mark="")
    {
		 global $baseinfo_c;
        $strSql="UPDATE event_type SET name_en_us='".$baseinfo_c->utf8trim($en_us)."',name_zh_hk='".$baseinfo_c->utf8trim($zh_hk)."',name_zh_cn='".$baseinfo_c->utf8trim($zh_cn)."',color_mark='".$baseinfo_c->utf8trim($color_mark)."' WHERE etid=".$baseinfo_c->utf8trim($keyValue).";";
        
         $baseinfo_c->execSql($strSql);
    }
    function select($pageSize,$pageNo,$where="")
    {
         if($where!="")
        {
             $where="name_zh_hk LIKE '%".$where."%'
            OR name_en_us LIKE '%".$where."%'
            OR name_zh_cn LIKE '%".$where."%'";
        }
         global $baseinfo_c;
         return $baseinfo_c->getPageRecords("event_type","etid",$pageSize,$pageNo,$where);
    }
    function getTotalPages($pageSize,$where="")
    {
        if($where!="")
        {
            $where="name_zh_hk LIKE '%".$where."%'
            OR name_en_us LIKE '%".$where."%'
            OR name_zh_cn LIKE '%".$where."%'";
        }
         global $baseinfo_c;
         return $baseinfo_c->getTablePages("event_type",$pageSize,$where);
    }
}
?>
